﻿using MongoDB.Bson.Serialization.Attributes;

namespace QPEngine
{
    [ObjectEvent]
    public class GamerEvent : ObjectEvent<Player>, IAwake
    {
        public void Awake()
        {
            this.Get().Awake();
        }
    }

    [BsonIgnoreExtraElements]
    public sealed class Player : EntityDB
    {
        [BsonIgnore]
        public Session session;

        [BsonIgnore]
        public bool Ai = false;

        public PlayerInfo Info;
        

        public void Awake()
        {
            Info = new PlayerInfo();
        }

        public override void Dispose()
        {
            if (this.Id == 0)
            {
                return;
            }

            base.Dispose();
        }
    }

    public sealed class PlayerState
    {
        /// <summary>
        /// 是否再游戏？
        /// </summary>
        public bool playing = false;
        /// <summary>
        /// 房间ID
        /// </summary>
        public int roomID = -1;
        /// <summary>
        /// 桌子ID
        /// </summary>
        public int deskID = -1;
        /// <summary>
        /// 座位号
        /// </summary>
        public int seatID = -1;
    }

}